#include <stdio.h>
#include <stdlib.h>

#define MAX_LINE_LENGTH 1024

//函数声明区域
int copyline(FILE *input,FILE *output);
int readline(FILE *input);

int main()
{
	FILE *input;//输入流
	FILE *output;//输出流
	input=fopen("iotext.txt","r");
	output=fopen("out_text.txt","r");
	if(input==NULL)
	{		
		perror("input");
		exit(EXIT_FAILURE);
	}
	if(output==NULL)
	{		
		perror("output");
		exit(EXIT_FAILURE);
	}
	readline(output);
	if(fclose(input)!=0){
		perror("fclose");
		exit(EXIT_FAILURE);
	}
	if(fclose(output)!=0){
		perror("fclose");
		exit(EXIT_FAILURE);
	}
	printf("Software Exit!");
	return 0;
}

int readline(FILE *input)
{
	char read_buffer [MAX_LINE_LENGTH];
	while(fgets(read_buffer,MAX_LINE_LENGTH,input)) 
		puts(read_buffer);
	return 0;
}


int copyline(FILE *input,FILE *output)
{
	char buffer [MAX_LINE_LENGTH];
	while(fgets(buffer,MAX_LINE_LENGTH,input)) 
		fputs(buffer,output);
	return 0;
}

